package ooday03;

public class Test {
    public static void main(String[] args) {

        Dog dog = new Dog("臭豆腐",1,"黄色");
        System.out.println(dog.name);
        dog = null;
        System.out.println(dog.name);
        dog.eat();

        Dog[] dogs = new Dog[3];
        dogs[0] = new Dog("小黑",2,"黑色");
        dogs[1] = new Dog("小白",3,"白色");
        dogs[2] = new Dog("小灰",4,"灰色");
        for (int i = 0;i<dogs.length;i++){
            System.out.println(dogs[i].age);
            System.out.println(dogs[i].color);
            dogs[i].drink();
            dogs[i].eat();
        }
        Chick[] chick = new Chick[2];
        chick[0] = new Chick("阿福",5,"棕黄色");
        chick[1] =new Chick("阿程",5,"浅灰色");
        for (int i = 0;i<chick.length;i++){
            System.out.println(chick[i].age);
            chick[i].layEggs();
            chick[i].layEggs();
        }
        Fish[] fish = new Fish[3];
        fish[0] = new Fish("蒙古上单",10,"粉红色");
        fish[1] = new Fish("阿猫",20,"红白色");
        fish[2] = new Fish("阿狗",3000,"蓝绿色");
        for (int i = 0;i<fish.length;i++){
            System.out.println(fish[i].name+"的年龄是"+fish[i].age);
            System.out.println(fish[i].name+"的颜色是"+fish[i].color);
            fish[i].swim();
        }
    }
}
